Ext.define('Emp.view.BaseList', {
	extend: 'Ext.container.Container',
	alias: 'widget.baselist',
	
	ajaxTotalCount: 0,
    ajaxCount: 0,
	
	initComponent: function() {
		this.callParent();
	},
	
	doBeforeLoad: function() {
		this.ajaxTotalCount++;
       	this.setLoading(true);
	},
	
	doTreeLoad: function(store, node, records, success) {
		this.ajaxCount++;
		if(this.ajaxCount === this.ajaxTotalCount) {
			this.ajaxTotalCount = 0;
			this.ajaxCount = 0;
			this.setLoading(false);
		}
		if(success === false) {
			Emp.msg.error(store.getProxy().getReader().rawData.message);
		}
	},
	
	doLoad: function(store, records, success) {
		this.ajaxCount++;
		if(this.ajaxCount === this.ajaxTotalCount) {
			this.ajaxTotalCount = 0;
			this.ajaxCount = 0;
			this.setLoading(false);
		}
		if(success === false) {
			Emp.msg.error(store.getProxy().getReader().rawData.message);
		}
	}
});